const mysql = require('mysql')
// let connection = mysql.createConnection({
//     host: 'localhost',
//     user: 'root',
//     password: '123456',
//     database: 'userlist'
// })
// connection.connect();
// module.exports = connection
const pool = mysql.createPool(require("../config/index").dev);
pool.on('connection', (connection) => {
    // logger.info("connection!");
});

pool.on('enqueue', () => {
    //logger.info('Waiting for available connection slot');
});
pool.getConnection(function (err, connection) {
    if (err) throw err;
    console.log('Connected to MySQL database');

    // 执行数据库操作
    // ...

    connection.release(); // 释放连接回连接池
});
module.exports = pool